package com.hdu.point_offer;

public class lcr134 {
    class Solution {
        public double myPow(double x, int n) {
            long count = n;
            if (count < 0)
            {
                count = -count;
                x = 1 / x;
            }
            double ans = 1;
            while (count > 0)
            {
                if ((count & 1) == 1)
                {
                    ans *= x;
                }
                x *= x;
                count >>= 1;
            }
            return ans;
        }
    }
}
